import {
    ref
} from 'vue';
import {
    ElMessage
} from 'element-plus';
// 'success' | 'warning' | 'info' | 'error'
const showClose = ref(true);
const plain = ref(true);
const grouping = ref(true);
const Message = {
    err: (text) => {
        ElMessage({
            showClose: showClose.value,
            plain: plain.value,
            grouping: grouping.value,
            duration: 6000,
            message: text,
            type: 'error',
        });
    },
    info: (text) => {
        ElMessage({
            showClose: showClose.value,
            plain: plain.value,
            grouping: grouping.value,
            duration: 2000,
            message: text,
            type: 'info',
        });
    },
    suc: (text) => {
        ElMessage({
            showClose: showClose.value,
            plain: plain.value,
            grouping: grouping.value,
            duration: 2000,
            message: text,
            type: 'success',
        });
    },
    warn: (text) => {
        ElMessage({
            showClose: showClose.value,
            plain: plain.value,
            grouping: grouping.value,
            duration: 6000,
            message: text,
            type: 'warning',
        });
    },
};

export default Message;